feat: automatically add AGENTUITY_SDK_KEY and AGENTUITY_PROJECT_KEY#442
feat: automatically add AGENTUITY_SDK_KEY and AGENTUITY_PROJECT_KEY#442
Conversation
…o .env file when running dev command - When no .env file exists, dev command now creates one with all API response env vars - Automatically includes AGENTUITY_SDK_KEY from user's API key - Automatically includes AGENTUITY_PROJECT_KEY from project data - Improves developer experience for cloned projects
WalkthroughAdds writing AGENTUITY_SDK_KEY and AGENTUITY_PROJECT_KEY to newly created .env during dev project sync when no .env exists. Content is appended after existing Env and Secrets entries; no other control flow or error handling changes. Changes
Sequence Diagram(s)sequenceDiagram
actor Developer
participant CLI as dev command (cmd/dev.go)
participant Sync as Project Sync
participant FS as Filesystem (.env)
Developer->>CLI: run dev
CLI->>Sync: synchronize project
Sync-->>CLI: returns apiKey, ProjectKey, Env, Secrets
CLI->>FS: check for .env
alt .env exists
CLI-->>FS: leave contents unchanged
else .env missing
CLI->>FS: create .env with Env and Secrets
Note right of FS: New lines added
CLI->>FS: append AGENTUITY_SDK_KEY=<apiKey>\nAGENTUITY_PROJECT_KEY=<ProjectKey>
end
CLI-->>Developer: dev ready
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
Poem
✨ Finishing Touches
🧪 Generate unit tests
🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. CodeRabbit Commands (Invoked using PR/Issue comments)Type Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Actionable comments posted: 1
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
cmd/dev.go (1)
80-84: Protect secrets: create .env with 0600 permissionsos.Create honors umask; on typical 0022 you'll get 0644 (world-readable). Since this file contains API keys/secrets, create it with 0600.
Apply this diff:
- of, err := os.Create(filename) + of, err := os.OpenFile(filename, os.O_CREATE|os.O_WRONLY|os.O_TRUNC, 0o600)
🧹 Nitpick comments (2)
cmd/dev.go (2)
94-94: Redundant Close() (already deferred)You already defer Close at Line 84; the explicit Close here is unnecessary and may return a spurious error later when deferred Close runs.
Apply this diff:
- of.Close()
85-93: Consider safe dotenv serialization (quoting/escaping)Raw k=v writes can break when values contain spaces, newlines, or '#'. Prefer a dotenv-aware writer or minimally quote values that need it.
If you want, I can wire up a small helper or integrate a dotenv writer utility.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
💡 Knowledge Base configuration:
- MCP integration is disabled by default for public repositories
- Jira integration is disabled
You can enable these sources in your CodeRabbit configuration.
📒 Files selected for processing (1)
cmd/dev.go(1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
- GitHub Check: Build and Test (macos-latest)
- GitHub Check: Analyze (go)
🔇 Additional comments (1)
cmd/dev.go (1)
91-93: LGTM: Adding AGENTUITY keys to newly created .envAppending these after Env/Secrets is sensible so they take precedence if duplicates exist. Nice DX improvement.
- Added: [AGENT-684] Check if zsh is installed before adding autocomplete in the CLI (#450) - Added: [AGENT-628] Unit tests (#441) - Added: feat: automatically add AGENTUITY_SDK_KEY and AGENTUITY_PROJECT_KEY to .env file when running dev command (#442) - Changed: Dont sort releases by commit msg (#447) - Changed: [AGENT-628] prevent local development env files from syncing to production (#440) - Fixed: Fix npm workspaces (#451) - Fixed: Fix 'Press any key to continue' to accept any key, not just Enter (#445) Co-Authored-By: unknown <>
- Added: [AGENT-684] Check if zsh is installed before adding autocomplete in the CLI (#450) - Added: [AGENT-628] Unit tests (#441) - Added: feat: automatically add AGENTUITY_SDK_KEY and AGENTUITY_PROJECT_KEY to .env file when running dev command (#442) - Changed: Dont sort releases by commit msg (#447) - Changed: [AGENT-628] prevent local development env files from syncing to production (#440) - Fixed: Fix npm workspaces (#451) - Fixed: Fix 'Press any key to continue' to accept any key, not just Enter (#445) Co-Authored-By: unknown <> Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
feat: automatically add AGENTUITY_SDK_KEY and AGENTUITY_PROJECT_KEY to .env file when running dev command
Summary by CodeRabbit